package com.visualize.demo.service;

        import com.visualize.demo.model.JsonResponse;
        import com.visualize.demo.model.Place;
        import com.visualize.demo.repository.PlaceRepository;
        import org.springframework.stereotype.Service;

        import java.util.HashMap;
        import java.util.List;
        import java.util.Map;

@Service
public class PlaceService extends BaseService {
    private final PlaceRepository placeRepository;

    public PlaceService(PlaceRepository placeRepository) {
        this.placeRepository = placeRepository;
    }


    public JsonResponse getData(String sTime, String eTime) {
        List<Place> placeList = placeRepository.getPlacesByTime(parseDate(sTime), parseDate(eTime));
        Map<String, List<Place>> content = new HashMap<>();
        content.put("list", placeList);
        return new JsonResponse(200, content);
    }
}
